import {reqExportFile, createExcel} from '../exportfile.js'
import request from '../request.ts'
//获取
export const getlogininforList = async  (search:Object) => {
    let r:any = await request({
        url: '/monitor/logininfor/list',
        method: 'get',
        loading: true,
        data:search
    })
    return {
        data:r.rows,
        total:r.total
    }
}

//删除日志
export const delLog = async  (id:String) => {
    let r:any = await request({
        url: '/monitor/logininfor/' + id,
        method: 'delete',
        loading: true
    })
    return r
}

export const exportLog = async  () => {
    let r:any = await reqExportFile('/monitor/logininfor/export')
    let currentDate = new Date();
    createExcel(r.data,`${currentDate.toString()}-登陆日志`)
    return true
}

//清空
export const cleanLog = async  () => {
    let r:any = await request({
        url: '/monitor/logininfor/clean',
        method: 'delete',
        loading: true
    })
    return r
}